-
-
Notifications
You must be signed in to change notification settings - Fork 19k
CI: Upgrade mypy to 1.17.1 and pyright to 1.1.404 #62224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
pandas/core/algorithms.py
Outdated
|
||
|
||
def diff(arr, n: int, axis: AxisInt = 0): | ||
def diff(arr, n: int | float | np.integer, axis: AxisInt = 0): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about np.floating
as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, added in next commit.
pandas/core/arrays/masked.py
Outdated
|
||
# error: Incompatible return value type (got "bool_", expected "bool") | ||
return self._mask.any() # type: ignore[return-value] | ||
return cast(bool, self._mask.any()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this return a NumPy bool?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, so I changed it to bool(self._mask.any())
pandas/io/parsers/readers.py
Outdated
|
||
|
||
def _validate_dialect(dialect: csv.Dialect) -> None: | ||
def _validate_dialect(dialect: csv.Dialect | Any) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why Any here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was a pain to get right. Did something different in next commit.
There is a typeshed issue that I had to deal with. Reported that at python/typeshed#14667
pandas/io/pytables.py
Outdated
|
||
@property | ||
def shape(self) -> Shape | None: | ||
def shape(self) -> Shape | list[int] | None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks to me like this never returns Shape = tuple[int, ...]
. Just do list[int] | None
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in next commit
@rhshadrach ready for another review. |
# source code using it.. | ||
|
||
return cast(bool, self._mask.any()) | ||
return bool(self._mask.any()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, just noting that the implementations for other _hasna
already have this bool(...)
where appropriate.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Thanks @Dr-Irv |
Spent the time to make the code compliant with the most recent releases of mypy and pyright